package com.fyt.algorithm.common;

public class ksm
{
    public static int ksm(int a,int b){
        int result=1;
        while (b>0){
            //b为奇数时,b除以2除到最后必然为1,则为奇数
            if((b&1)==1){
                result*=a;
            }
            a*=a;
            b=b>>1;
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(ksm(2,10));
    }

}
